/**
 * Copyright (c) 2008-2010 Ardor Labs, Inc.
 *
 * This file is part of Ardor3D.
 *
 * Ardor3D is free software: you can redistribute it and/or modify it 
 * under the terms of its license which may be found in the accompanying
 * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
 */

package com.roslan.games.test;

import com.ardor3d.example.ExampleBase;
import com.ardor3d.extension.model.obj.ObjGeometryStore;
import com.ardor3d.extension.model.obj.ObjImporter;
import com.ardor3d.math.Vector3;

/**
 * Simplest example of loading a Wavefront OBJ model.
 */
public class SimpleObjExample extends ExampleBase {
	public static void main(final String[] args) {
		ExampleBase.start(SimpleObjExample.class);
	}

	@Override
	protected void initExample() {
		_canvas.setTitle("Ardor3D - Simple Obj Example");
		_canvas.getCanvasRenderer().getCamera().setLocation(new Vector3(0, 50, 200));

		// Load the collada scene
		final long time = System.currentTimeMillis();
		final ObjImporter importer = new ObjImporter();
//		try {
//			importer.setTextureLocator(new SimpleResourceLocator(ResourceLocatorTool.getClassPathResource(SimpleObjExample.class, "com/ardor3d/example/media/models/obj/")));
//		} catch (final URISyntaxException ex) {
//			ex.printStackTrace();
//		}
		final ObjGeometryStore storage = importer.load("models/obj/shipA_OBJ.obj");
		System.out.println("Importing Took " + (System.currentTimeMillis() - time) + " ms");

		_root.attachChild(storage.getScenegraph());
	}
}